package vip.liux.contracts.models.product;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import vip.liux.contracts.shared.enums.product.ShelfState;
import vip.liux.contracts.shared.value.SpecDetail;
import vip.liux.domain.entities.auditing.AuditedEntity;

import java.math.BigDecimal;
import java.util.List;

@Getter
@Setter
@Entity
@Table(name = "shop_product_detail")
public class ProductDetail extends AuditedEntity<Long> {
    /**
     * spu
     */
    @Column(name = "spu", nullable = false, length = 128)
    private String spu;

    /**
     * sku
     */
    @Column(name = "sku", nullable = false, length = 128)
    private String sku;

    /**
     * 商品条码
     */
    @Column(name = "bar_code", length = 256)
    private String barCode;

    /**
     * 市场价
     */
    @Column(name = "market_price", precision = 10, scale = 2)
    private BigDecimal marketPrice;

    /**
     * 销售价
     */
    @Column(name = "sale_price", precision = 10, scale = 2)
    private BigDecimal salePrice;

    /**
     * 商品库存
     */
    @Column(name = "stock_total", nullable = false)
    private Integer stockTotal;

    /**
     * sku 图片
     */
    @Column(name = "image", nullable = false, length = 256)
    private String image;

    /**
     * 商品状态
     */
    @Column(name = "shelf_state", nullable = false)
    @Enumerated(EnumType.ORDINAL)
    private ShelfState shelfState;

    /**
     * 商品规格
     */
    @Column(name = "spec_data_list")
    private List<SpecDetail> specDataList;

    public void setId(Long id) {
        super.setId(id);
    }
}